<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../css/denglu.css">
    <link rel="stylesheet" href="../css/清除样式.css">
    <link rel="stylesheet" href="../css/header.css">
    <link rel="stylesheet" href="../css/footer.css">
    <link rel="icon" href="https://www.anta.com/favicon.ico">
    <link rel="stylesheet" href="../font/iconfont.css">
</head>

<body>
    <!-- 头部 -->
    <header>

    </header>



    <div id="denglu">
        <div id="denglu-1">
            <div id="denglu-2">
                <div id="denglu-2-1">
                    <div id="denglu-2-2">
                        <div id="denglu-2-3">
                            <h6 class="h">账号密码登录</h6>
                            <h6>短信快捷登录</h6>
                        </div>
                        <div id="denglu-2-4">
                            <div id="denglu-2-5">
                                <input id="input11" type="text" placeholder="邮箱/手机号码/安踏账号">
                            </div>
                            <div id="denglu-2-5">
                                <input id="input22" type="text" placeholder="密码">
                            </div>
                            <div id="denglu-2-6">
                                <input id="btn1" type="submit" value="立即登录">
                            </div>
                        </div>
                    </div>
                    <!-- 其他方式登录 -->
                    <div id="denglu-3">
                        <div id="denglu-3-1">
                            <p>其他方式登录</p>
                        </div>
                        <div id="denglu-3-2">
                            <a href="javasctipt:" class="icon-type"></a>
                        </div>
                    </div>
                    <div id="denglu-4">
                        <a href="javascript:">账号注册</a>
                        <span>|</span>
                        <a href="javascript:">忘记密码</a>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 底部 -->
    <footer>

    </footer>
</body>

</html>
<script src="../js/jQuery.js"></script>
<script src="../js/index.js"></script>
<script src="../js/ajaxtool.js"></script>
<script>
    let btn = document.querySelector("#btn1");
    btn.onclick = function () {
        $ajax({
            type: "POST",
            url: "../goodsAndShoppingCart/login.php",
            data: {
                username: $("#input11").val(),
                userpass: $("#input22").val()
            },
            success: function (res) {
                console.log(res);//响应回来的数据
                if (res.trim() == 'success') {
                    alert('登录成功');
                    console.log(alert);
                    // setCookie('username', $('#input11').value, 7);
                    // setTimeout(function () {
                        location.href = '../index.html';
                    // }, 100)
                } else if(res.trim() == 'fail'){
                    alert('登录失败,请注册');
                }
            }
        })
    }


</script>